<template>
  <div id="home">
    <!-- 本页面是课程概览页的布局，概览的具体设置查看Info.vue页面 -->
    <topBar
      :isNotLogIn="isNotLogIn"
      :isManager="isManager"
      :userName="userName"
    ></topBar>
    <img src="@/assets/image/background.svg" width="100%" height="100%" />
    <el-container id="mainContainer">
      <el-aside >
        <el-col :span="12">
          <el-menu
            default-active="1"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
          >
          <el-menu-item index="1">
              <i class="el-icon-s-home"></i>
              <span slot="title">首页</span>
            </el-menu-item>
            <el-menu-item index="2">
              <i class="el-icon-message"></i>
              <span slot="title">邮件检测</span>
            </el-menu-item>

            <el-menu-item index="3">
              <i class="el-icon-s-custom"></i>
              <span slot="title">打卡检测</span>
            </el-menu-item>
            <el-menu-item index="4">
              <i class="el-icon-data-line"></i>
              <span slot="title">流量监测</span>
            </el-menu-item>
            <el-menu-item index="5">
              <i class="el-icon-s-opportunity"></i>
              <span slot="title">其他异常</span>
            </el-menu-item>
          </el-menu>
        </el-col>
      </el-aside>
      <el-main>
        <div>
          <router-view></router-view>
        </div>
      </el-main>
    </el-container>
    <!-- <bottomBar></bottomBar> -->
  </div>
</template>
<script>
import topBar from "@/components/common/topBar";
// import bottomBar from '@/components/common/bottomBar'
export default {
  components: {
    topBar,
    // bottomBar
  },
  data() {
    return {
      isNotLogIn: true,
      userName: "",
      isManager: true,
    };
  },
  created() {
    this.getParams();
  },
  watch: {
    "$route.path": "getParams",
  },
  methods: {
    handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
    // 接收用户名和登录状态
    getParams() {
      const res = JSON.parse(window.sessionStorage.getItem("user"));
      if (res === null) return;
      this.userName = res.userName;
      this.isNotLogIn = false;
      this.isManager = res.isManager;
    },
  },
};
</script>
<style>
.header .userInfo {
  cursor: pointer;
}
.homeWelcome {
  text-align: center;
  font-size: 30px;
  padding-top: 50px;
}
#home {
  height: 100%;
  width: 100%;
}
#mainContainer {
  position: absolute;
  top: 50px;
  height: calc(100% - 100px);
  width: 100%;
}
</style>
